<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">

<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>活动列表</title>
</head>

<body>
	<div>

		<table>

			<thead>
				<th>
					活动id
				</th>
				<th>
					标题
				</th>
				<th>
					等级
				</th>
				<th>
					开始时间
				</th>
				<th>
					结束时间
				</th>
				<th>
					状态
				</th>
			</thead>
			<tr th:each="a:${activities}">
				<td th:text=${a.id}></td>
				<td th:text=${a.title}></td>
				<td th:text=${a.category}></td>
				<td th:text=${a.remark}></td>
				<td th:text=${a.startTime}></td>
				<td th:text=${a.endTime}></td>
				<td th:text=${a.state}></td>
			</tr>

		</table>



		<table id="table">

		</table>
	</div>
</body>
<script>
	//创建XMLHttpRequest对象
	var httpRequest = new XMLHttpRequest();

	// 定义参数:
	var params = "";// 发送请求的参数
	var url = " dofindactivities";// 请求的地址 
	//创建回调函数 
	httpRequest.onreadystatechange=function doGetActivities() { 
		if ( 
			//连接状态 4 表示访问已经停止 
			httpRequest.readyState == 4 && 
			// 200 表示访问访问正常 
			httpRequest.readyState==200 ) {
		// 将JSON数据进行输入 
		var activities=JSON.parse(httpRequest.responseText); 
		var table=document.getElementById("table"); 
		
		} 
	}
	//创建连接
	httpRequest.open("GET", url, true); 
	//发送异步请求 
	httpRequest.send(); 
	</script>

</html>